home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nibble Magazine
/
nib16.dsk
/
APPLE TALKER.bas
< prev
next >
Wrap
BASIC Source File
|
2023-02-26
|
5KB
|
138 lines
1 REM **********************
2 REM * APPLE TALKER *
3 REM * BY MIKE EVE *
4 REM * COPYRIGHT (C) 1983 *
5 REM * BY MICROSPARC, INC *
6 REM * LINCOLN, MA. 01773 *
7 REM **********************
20 PRINT CHR$(4);"BLOAD APPLE TALKER.OBJ": REM LOAD AT $300
30 REM INITIALIZATION
40 DEF FN PK(X) = PEEK(X) +256 * PEEK(X +1)
50 ONERR GOTO 1210
60 M2 = FN PK(115): REM GET HIMEM
70 M1 = FN PK(105): REM TOP OF PROGRAM
80 M1 = (2 + INT(M1/1000)) *1000: REM 1000<VARIABLE STORAGE<2000
90 P1 = M1:P2 = P1: REM BUFFER PTRS
100 O1 = P1:O2 = P2
110 TW = 5
120 TD = 11: POKE 780, INT(TD): REM COMMON DELAY
130 HIMEM: M1: REM SET NEW HIMEM
140 BS = 1/(8 *(5 *(TD -1) +87) *1E -6): REM BYTES/SECOND
150 S$ = ".SOUND": REM SAVE FILE SUFFIX
160 REM DEFINE MENU ITEMS
170 C$(1) = "ECHO"
180 C$(2) = "RECORD"
190 C$(3) = "PLAY"
200 C$(4) = "SAVE"
210 C$(5) = "LOAD"
220 C$(6) = "RESTORE POINTERS"
230 C$(7) = "SET POINTERS"
240 C$(8) = "QUIT"
250 MC = 8
260 REM DISPLAY SCREEN
270 HOME : PRINT "** COPYRIGHT 1983 BY MICROSPARC, INC. **": PRINT TAB( 13);"APPLE TALKER": PRINT
280 FOR I = 1 TO MC: PRINT TAB( 10);I;") ";C$(I): NEXT I
290 GOSUB 1150: REM PRINT STATUS
300 VTAB MC +5: HTAB 10
310 INPUT "COMMAND ?";C: IF C <1 OR C >MC THEN 260
320 HTAB 10: INVERSE : PRINT : PRINT C$(C): NORMAL : PRINT
330 ON C GOSUB 350,390,470,660,700,820,850,1050
340 GOTO 260
350 REM ECHO
360 PRINT "HIT ANY KEY TO STOP"
370 CALL 774
380 RETURN
390 REM RECORD
400 P1 = M1:P2 = P1 +TW *BS -1
410 GOSUB 1090: CALL 777: REM ZERO BUFFER
420 GOSUB 1090: REM SETUP
430 PRINT "HIT ANY KEY TO BEGIN"
440 CALL 774: REM ECHO TILL KEY
450 CALL 768: REM RECORD
460 RETURN
470 REM PLAYBACK
480 PRINT "USE KEYS 1 AND 2 TO EDIT": PRINT "ANY OTHER TO EXIT"
490 GOSUB 1090: REM SETUP
500 CALL 771: REM PLAY
510 KY = PEEK(25): REM READ KEY
520 IF KY = 0 THEN RETURN : REM NO KEY
530 KY = KY -128 - ASC("0")
540 IF KY = 1 THEN GOTO 570
550 IF KY = 2 THEN GOTO 620
560 RETURN
570 IF P2 < FN PK(6) THEN 500: REM P1 MUST BE > P2
580 O1 = P1:P1 = FN PK(6): REM SAVE BEGIN
590 GOSUB 1150: REM PRINT STATUS
600 GOSUB 1130: REM PAUSE
610 GOTO 500: REM PLAY MORE
620 O2 = P2:P2 = FN PK(6): REM SAVE END
630 GOSUB 1150: REM PRINT STATUS
640 GOSUB 1130: REM PAUSE
650 GOTO 500
660 REM SAVE
670 INPUT "FILENAME ? ";F$
680 PRINT CHR$(4)"BSAVE"F$S$",A" INT(P1);",L"; INT(P2 -P1)
690 RETURN
700 REM LOAD
710 IF P2 = M1 THEN 770: REM DO NOTHING
720 INPUT "APPEND ?(Y/N)";A$
730 IF A$ < >"Y" AND A$ < >"N" THEN 720
740 IF A$ = "Y" THEN 770
750 P1 = M1:P2 = M2: GOSUB 1090: CALL 777:P2 = P1: REM ZERO BUFFER
760 GOSUB 1150: GOTO 780: REM PRINT STATUS
770 O1 = P1:P1 = P2:P2 = M2: GOSUB 1090: CALL 777:P2 = P1:P1 = O1: REM ZERO REMAINING BUFFER
780 CALL -868: INPUT "FILENAME ? ";F$: PRINT CHR$(4)"BLOAD"F$S$",A" INT(P2)
790 P2 = P2 + FN PK( -21920): REM CALCULATE END OF BLOAD
800 IF P2 >M2 THEN PRINT "ERROR:BLOAD WENT PAST HIMEM": PRINT "PLEASE REBOOT": END
810 RETURN
820 REM RESET P1 AND P2
830 P1 = O1:P2 = O2
840 RETURN
850 REM SET PARAMETERS
860 PRINT "ENTER NEW VALUE OR RETURN IF NO CHANGE"
870 PRINT : PRINT "P1="; INT(P1);
880 INPUT " ";A$: IF LEN(A$) = 0 THEN 910
890 T1 = VAL(A$): IF T1 > = M1 AND T1 < = M2 THEN P1 = T1: GOTO 910: REM ACCEPT IF IN RANGE
900 GOTO 860
910 PRINT "P2="; INT(P2);
920 INPUT " ";A$: IF LEN(A$) = 0 THEN 950
930 T2 = VAL(A$): IF T2 < = M2 AND T2 > = P1 THEN P2 = T2: GOTO 950: REM ACCEPT IF IN RANGE
940 GOTO 910
950 T1 = 5 *(TD -1) +87: REM COMPUTE DELAY TIME
960 PRINT "SAMPLE INTERVAL="; INT(T1);
970 INPUT " ";A$: IF LEN(A$) = 0 THEN GOTO 1000
980 T2 = VAL(A$): IF T2 <87 OR T2 >343 THEN GOTO 950: REM 343=256+87(MAX DELAY THAT FITS IN ONE BYTE)
990 TD = INT((T2 -87)/5) +1: POKE 780, INT(TD):BS = 1/(8 *(5 *(TD -1) +87) *1E -6)
1000 PRINT "TIME WINDOW="; INT(TW);
1010 INPUT " ";A$: IF LEN(A$) = 0 THEN GOTO 1040
1020 T3 = VAL(A$): IF T3 >0 AND M1 +BS *T3 <M2 THEN TW = T3: GOTO 1040
1030 GOTO 1000
1040 RETURN
1050 REM QUIT
1060 GOSUB 1300: REM RESET HIMEM
1070 HOME
1080 END
1090 REM SETUP P1 AND P2
1100 POKE 7, INT(P1/256): POKE 6, INT(P1 -256 * INT(P1/256))
1110 POKE 9, INT(P2/256): POKE 8, INT(P2 -256 * INT(P2/256))
1120 RETURN
1130 REM PAUSE
1140 FOR I = 1 TO 200: NEXT I: RETURN
1150 REM PRINT STATUS
1160 CV = PEEK(37): REM SAVE CURSOR ROW
1170 VTAB 22: CALL -868: REM CLEAR LINE
1180 VTAB 22: INVERSE : PRINT "MIN "; INT(M1);" MAX "; INT(M2);" P1 "; INT(P1);" P2 "; INT(P2): NORMAL
1190 VTAB CV: REM RESTORE CURSOR
1200 RETURN
1210 REM ERROR
1220 ER = PEEK(222)
1230 PRINT "ERROR # ";ER
1240 POKE 216,0
1250 PRINT "RESTARTING PROGRAM"
1260 GOSUB 1300: REM RESTORE HIMEM
1270 CLEAR : REM RESET SUBROUTINE STACK,ETC
1280 FOR I = 1 TO 2000: NEXT I: REM PAUSE
1290 GOTO 30
1300 REM RESET HIMEM
1310 POKE 116, INT(M2/256): POKE 115,(M2 -256 * PEEK(116))
1320 RETURN